SendMessage
Applications can now use SendMessage() to communicate with mIRC.
Performing Commands The following call to SendMessage() makes mIRC perform the commands that you specify.
SendMessage(mHwnd, WM_MCOMMAND, cMethod, cIndex)
mHwnd - the handle of the main mIRC window, or the handle of a Channel, Query, etc. window.
WM_MCOMMAND - which should be defined as WM_USER + 200
cMethod - how mIRC should process the message, where: 1 = as if typed in editbox 2 = as if typed in editbox, send as plain text 4 = use flood protection if turned on, can be or'd with 1 or 2
cIndex - create a uniquely named mapped file, where lParam = N, the mapped filename is mIRCN. If lParam is zero, the filename is mIRC, as in previous versions.
Returns - 1 if success, 0 if fail
Evaluating Identifiers and Variables The following call to SendMessage() makes mIRC evaluate the contents of any line that you specify.
SendMessage(mHwnd, WM_MEVALUATE, 0, cIndex)
mHwnd - the handle of the main mIRC window, or the handle of a Channel, Query, etc. window.
WM_MEVALUATE - should be defined as WM_USER + 201
cIndex - create a uniquely named mapped file, where lParam = N, the mapped filename is mIRCN. If lParam is zero, the filename is mIRC, as in previous versions.
Returns - 1 if success, 0 if fail
Mapped Files The application that sends these messages must create a mapped file named mIRC with CreateFileMapping().
The lParam (cIndex) parameter indicates the mapped file name that you have used, where lParam = N, the mapped filename is mIRCN. If lParam is zero, the filename is mIRC.
When mIRC receives the above messages, it will open this file and use the data that this mapped file contains to perform the command or evaluation. In the case of an evaluation, mIRC will output the results to the mapped file.
The mapped file must be at least 1024 bytes in length.
To prevent simultaneous access to the mapped file, your code must check whether the mapped file exists or not before using it. If it exists, you should assume that it is in use by another program, and should try again later. |